#include "cardTest.h"

CardTest::CardTest()
{
	srand((unsigned)time(NULL));
}

void CardTest::SetTest()
{
	int value = rand() %13 + 1 ; 
	char suit =  rand()%4 ;
	this->cardObj.Set( value , suit ) ;
	cout<<"Set the value is :"<<value<<endl;
	cout<<"Set the suit is :"<<char(suit+3)<<endl;
}

void CardTest::SwapTest()
{
	int value = rand() %13 + 1 ; 
	int suit =  rand()%4 ;
	Card swap = Card().Set( value, suit );
	cout<<"The current Card is :"<<this->cardObj.Face()<<endl;
	cout<<"The swap Card is :"<<swap.Face()<<endl;
	this->cardObj.Swap( swap ) ;
	cout<<"After swapping the Card is :"<<this->cardObj.Face()<<endl;
}

void CardTest::FaceTest()
{
	cout<<"This Card's Face is:"<<this->cardObj.Face()<<endl;
}

void CardTest::ValueTest()
{
	cout<<"This Card's Value is :"<<this->cardObj.Value()<<endl;
}

void CardTest::SuitTest()
{
	cout<<"This Card's Suit is :"<<this->cardObj.Suit()<<endl;
}

void CardTest::IntValueTest()
{
	cout<<"The Int Value is :"<<this->cardObj.GetValue()<<endl;
}

void CardTest::SetValueTest()
{
	int value = rand() % 13 + 1 ;
	cout<<"The current value is :" <<this->cardObj.GetValue()<<endl;
	cout<<"The set value is : " <<value <<endl;
	this->cardObj.SetValue( value ) ;
	cout<<"The current value is :"<<this->cardObj.GetValue()<<endl;
}

void CardTest::SetSuitTest()
{
	char suit = rand() % 4 ;
	cout<<"The current suit is :" <<this->cardObj.Suit()<<endl;
	cout<<"The set suit is : " <<char(suit + 3)<<endl;
	this->cardObj.SetSuit( suit ) ;
	cout<<"The current suit is :"<<this->cardObj.Suit()<<endl;
}

void CardTest::ClearTest()
{
	cout<<"The current card is :"<<this->cardObj.Face()<<endl;
	this->cardObj.Clear();
	cout<<"Now the card is :"<<this->cardObj.Face()<<endl;
	cout<<"The value of the card is :"<<this->cardObj.GetValue()<<endl;
	cout<<"The suit of the card is :"<<this->cardObj.Suit()<<endl;
}

void CardTest::EmptyTest()
{
	Card empty ;
	if( this->cardObj == empty )
		cout<<"This card is empty!"<<endl;
	else cout<<"This card is not empty!"<<endl;
}

void CardTest::CardUnitTest()
{
	SetTest();
	SwapTest();
	FaceTest();
	ValueTest();
	SuitTest();
	IntValueTest();
	SetValueTest();
	SetSuitTest();
	ClearTest();
	EmptyTest();
}